﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Marbles.CMS.ContentTypes
{
    public class TemplateDefinition
    {
        public string Title { get { return this._Title; } }
        public string TemplateName { get { return this._TemplateName; } }
        public string TemplateSourcePath { get { return this._TemplateSourcePath; } }
        public string ThemeName { get { return this._ThemeName; } }
        public List<TemplateContentDefinition> ContentIds { get { return this._ContentIds; } }

        public TemplateContentDefinition this[string key]
        {
            get
            {
                foreach (TemplateContentDefinition item in _ContentIds)
                {
                    if (item.Name == key) { return item; }
                }
                return null;
            }
        }

        private string _Title = string.Empty;
        private string _TemplateName = string.Empty;
        private string _TemplateSourcePath = string.Empty;
        private string _ThemeName = string.Empty;
        private List<TemplateContentDefinition> _ContentIds = null;


        public Dictionary<string, string> GetDictionary()
        {
            Dictionary<string, string> items = new Dictionary<string, string>();
            foreach (TemplateContentDefinition item in this.ContentIds)
            {
                items.Add(item.Name, item.Title);
            }
            return items;
        }

        public TemplateDefinition(string Title, string TemplateName, string TemplateSourcePath, string ThemeName)
        {
            this._Title = Title;
            this._TemplateName = TemplateName;
            this._TemplateSourcePath = TemplateSourcePath;
            this._ThemeName = ThemeName;
            this._ContentIds = new List<TemplateContentDefinition>();
        }
        
    }


}
